package com.sugon.dao;

import com.sugon.entity.SysMsgEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface SysMsgDao {
    /**
     * selectSysMsgData
     *
     * @return
     */
    List<SysMsgEntity> select(Map<String, Object> param);

    /**
     * insertSysMsgData
     *
     * @param msgEntity
     * @return
     */
    Integer save(SysMsgEntity msgEntity);

    /**
     * updateSysMsgData
     *
     * @param msgEntity
     * @return
     */
    Integer update(SysMsgEntity msgEntity);

    /**
     * selectSysMsgAllData
     *
     * @param userId
     * @return
     */
    List<Map<String, Object>> selectSysMsgAllData(@Param("userId") String userId);

    /**
     * deleteSysMsgData
     *
     * @param data_id
     * @param data_type
     * @return
     */
    Integer delete(@Param("dataid") String data_id, @Param("datatype") String data_type, @Param("startDate") String startDate);

    /**
     * querySysMsgDataResource
     *
     * @param type
     * @param userId
     * @return
     */
    List<Map<String, Object>> querySysMsgDataResource(@Param("type") String type, @Param("userId") String userId);

    /**
     * upSysMsgDataResource
     *
     * @param msgEntity
     * @return
     */
    Integer upSysMsgDataResource(SysMsgEntity msgEntity);

    /**
     * selectDept
     *
     * @return
     */
    List<Map<String, Object>> selectDept();

    /**
     * 批量删除消息
     *
     * @param whereSql 批处理的where sql
     * @return
     */
    int batchDelete(@Param("whereSql") String whereSql);

    /**
     * 根据数据ID删除对应的消息
     *
     * @param dataId 对应的业务数据ID
     * @return
     */
    @Delete("DELETE FROM SYS_MSG WHERE DATA_ID = #{dataId}")
    int deleteByDataId(@Param("dataId") String dataId);

    /**
     * 批量标记消息已读
     *
     * @param whereSql 批处理的where sql
     * @return
     */
    int batchMarkReaded(@Param("whereSql") String whereSql);

}
